<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateDevicesTable extends Migration
{
	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('devices', function (Blueprint $table) {
			$table->increments('id');
			$table->unsignedSmallInteger('agent_id')->default(0)->comment('代理商ID');
			$table->string('agent_no', 16)->default('')->comment('代理商号');
			$table->unsignedMediumInteger('shop_id')->default(0)->comment('门店ID');
			$table->string('device_no', 16)->default('')->comment('设备编号');
			$table->string('device_model', 16)->default('')->comment('设备型号');
			$table->boolean('state')->default(0)->comment('0:未激活 1:已激活 2:已禁用');
			$table->unsignedMediumInteger('user_id')->default(0)->comment('关联激活用户');
			$table->decimal('latitude', 9, 6)->default(0)->comment('注册纬度');
			$table->decimal('longitude', 9, 6)->default(0)->comment('注册经度');
			$table->timestamps();
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::dropIfExists('devices');
	}
}
